/*
 * message_buf.h
 *
 * Created: 12.01.2014 18:26:42
 *  Author: Vladislav
 */ 


#ifndef MESSAGE_BUF_H_
#define MESSAGE_BUF_H_

#include "includes.h"

OS_MEM* OsMemBuffer;
OS_MEM* OsMemList;

typedef struct _MemMsg
{
	uint8_t block_type;
	uint8_t message_type;
	uint8_t data_len;
	uint8_t data[4];
	uint8_t priority_level;
}MemMsg;

typedef struct _Node {
	//CAN_MSG msg;
	struct _Node *next;
	struct _Node *prev;
	MemMsg value;
} Node;

typedef struct _DblLinkedList
{
	size_t size;
	Node *head;
	Node *tail;
	Node *cur;
	//Node nds[32];
} DblLinkedList;



DblLinkedList* createDblLinkedList(void);
void deleteDblLinkedList(DblLinkedList **list);
void pushFront(DblLinkedList *list, void *data);
void* popFront(DblLinkedList *list);
void pushBack(DblLinkedList *list, void *value);
void* popBack(DblLinkedList *list);
Node* getNth(DblLinkedList *list, size_t index);
void insert(DblLinkedList *list, size_t index, void *value);
void* deleteNth(DblLinkedList *list, size_t index);  
void* deleteCurr(DblLinkedList *list);

/*/////////////////////////////////////////////////////////////////////////////////////////////*/

#endif /* MESSAGE_BUF_H_ */